﻿using Analysis.Models.EchartModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Utils;

namespace Analysis.Controllers.PCController
{
    public class TestAdminLETController : LoginController
    {
        // GET: TestAdminLET
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult TestEchart()
        {
            return View();
        }

        public JsonResult GetEchartBar()
        {
            Result<BarOrLineModel> result = new Result<BarOrLineModel>();

            List<List<decimal>> dataList = new List<List<decimal>>();
            List<string> legenList = new List<string>();
            legenList.Add("销售额");
            List<decimal> amountList = new List<decimal>();
            List<string> nameList = new List<string>();
            Random ran = new Random();
            for (int i = 1; i <= 10; i++)
            {
                nameList.Add(i.ToString());
                amountList.Add(ran.Next(1000));
            }
            dataList.Add(amountList);

            BarOrLineModel bar = new BarOrLineModel();
            bar.NameList = nameList;
            bar.LegendList = legenList;
            bar.DataList = dataList;

            result.Status = 200;
            result.Body = bar;

            return Json(result, JsonRequestBehavior.AllowGet);
        }
    }
}